package com.csxy.six.controller;

import com.csxy.six.R2;
import com.csxy.six.service.PermissionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/permission-center")
@Tag(name = "权限中心", description = "权限管理相关接口")
@SecurityRequirement(name = "JWT")
public class PermissionCenterController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("/teachers")
    @Operation(summary = "获取教师列表", description = "获取所有教师账号")
    public R2<Void> listTeachers() {  // 修改为 R2<Void>
        // 检查教师权限
        permissionService.checkTeacherPermission();

        // 实际实现中应调用服务层获取教师列表
        return R2.ok().message("教师列表获取成功");  // 使用无数据返回的 ok()
    }

    @GetMapping("/students")
    @Operation(summary = "获取学生列表", description = "获取所有学生账号")
    public R2<Void> listStudents() {  // 修改为 R2<Void>
        // 检查教师权限
        permissionService.checkTeacherPermission();

        // 实际实现中应调用服务层获取学生列表
        return R2.ok().message("学生列表获取成功");  // 使用无数据返回的 ok()
    }
}